<%--
  用户首页
  Author: ZheL2
  Date: 2023/12/12
  Version: 1.0
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="m" uri="/WEB-INF/tld/mytag.tld"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>校园社团管理系统</title>
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/bootstrap.css'/>">

    <link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/style.css' />">
    <script src="<c:url value='/resources/js/bootstrap.bundle.js'/> "></script>
    <script src="<c:url value='/resources/js/user.js'/> "></script>
</head>
<body>
    <div class="page-container">
        <!-- Top Navbar -->
        <header>
            <jsp:include page="userHeader.jsp"/>
        </header>

        <!-- 页面内容 -->
        <div class="content">
            <div class="container-fluid " style="width: 70%">
                <!-- 用户欢迎信息 -->
                <div class="row">
                    <div class="information-box">
                        <h1>Welcome ${sessionScope.user.username}</h1>
                        <p>当前时间：<span id = "clock"></span></p>
                    </div>
                </div>

                <hr>
                <div class="row">
                    <!-- 左侧功能栏 -->
                    <div class="col-3 mt-4">

                        <a href="<c:url value='/user/myClubs'/> " style="text-decoration: none; color: black;">
                            <h5>&nbsp;&nbsp;   已加入 ${clubCount} 个社团</h5>
                        </a><hr>
                    </div>

                    <!-- 右侧内容栏 -->
                    <div class="col-9 px-4">
                        <c:if test="${not empty clubs}">
                            <c:forEach items="${clubs}" var="club">
                                <a href="<c:url value='/user/clubInfo?clubId=${club.clubID}'/> " style="text-decoration: none; color:black;">
                                    <div class="information-box" >
                                        <h1>${club.clubName}</h1>
                                        <p>${club.description}</p>
                                    </div>
                                </a>
                            </c:forEach>
                        </c:if>
                        <c:if test="${empty clubs}">
                            <p>还没有加入社团</p>
                        </c:if>
                    </div>

                    <hr>

                    <!-- 左侧功能栏 -->
                    <div class="col-3 mt-4">
                        <a href="<c:url value='/user/myActivities'/>" style="text-decoration: none; color: black;">
                            <h5>&nbsp;&nbsp;   已参加 ${activityCount} 个活动</h5>
                        </a><hr>
                    </div>

                    <!-- 右侧内容栏 -->
                    <div class="col-9 px-4">
                        <c:if test="${not empty activities}">
                            <c:forEach items="${activities}" var="activity">
                                <a href="<c:url value='/user/activityInfo?activityID=${activity.activityID}'/> " style="text-decoration: none; color:black;">
                                    <div class="information-box" >
                                        <h1>${activity.activityName}</h1>
                                        <p>${activity.description}</p>
                                    </div>
                                </a>
                            </c:forEach>
                        </c:if>
                        <c:if test="${empty activities}">
                            <p>还没有参加活动</p>
                        </c:if>
                    </div>
                </div>
            </div>
        </div>

        <footer>
            <m:footer/>
        </footer>
    </div>
</body>

</html>
